
#include <fstream>
#include <iostream>
using namespace std;


int main( void ) {
	// ios::in
	ifstream ifs1( "./file" , ios::in );
	if( !ifs1 ) {
		cerr << "ifs1 has some thing error" << endl;
	}

	int i; double d; string s1, s2;
	ifs1 >> i >> d >> s1 >> s2;
	if( !ifs1 ) {
		cerr << "ifs1 has some thing error to read" << endl;
	}

	cout << i << ' ' << d << ' ' << s1 << ' ' << s2 << endl;
	ifs1.close( );

	// ios::ate
	ifstream ifs2( "./file", ios::ate );
	if( ifs2 ) {
		cerr << "ifs2 err" << endl;
	}
	// Set the ptr to the begin.
	ifs2.seekg( 0, ios::beg );
	int ii; double dd; string ss1, ss2;
	ifs2 >> ii >> dd >> ss1 >> ss2;
	if( !ifs2 ) {
		cout << "ifs2 read err" << endl;
	}
	cout << ii << ' ' << dd << ' ' << ss1 << ' ' << ss2 << endl;

	return 0;
}

